package com.icangya.DAO.impl;

import com.icangya.DAO.IOdevityDAO;
import com.icangya.domain.Odevity;
import org.hibernate.Query;
import org.hibernate.Session;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;

import java.util.List;


@Repository
public class OdevityDAOImpl extends  BaseDAO<Odevity> implements IOdevityDAO {

    Logger logger = LoggerFactory.getLogger(this.getClass());


    @Override
    public List getOdevityAll() {

        Session session=  getHibernateTemplate().getSessionFactory().getCurrentSession();
        String hql="FROM Odevity od order by od.createTime desc";
        Query query=session.createQuery(hql);
       query.setMaxResults(14);
        List list=query.list();
        if(list !=null)
            return  list;
        return null;

    }
}
